#include <iostream>

using namespace std;
using ll = long long;

int main(){
    ll a, h, b, k;
    cin >> a >> h >> b >> k;
    ll ret = 0;
    while (1){
        ret += (a + b);
        h -= b;
        k -= a;
        if (h <= 0 || k <= 0) break;
    }
    if (h > 0) ret += a * 10;
    else if(k > 0) ret += b * 10;
    
    cout << ret << endl;
    return 0;
}